<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=7" />
        <title>后台管理中心</title>
        <?php echo $this->_var['system_css']; ?>
        <?php echo $this->_var['system_js']; ?>
    </head>
    <body>
        <?php echo $this->fetch('message.html'); ?>
        <div class="pad-lr-10" style="margin-top: 15px;">
            <table width="100%" cellspacing="0" class="search-form">
                <tbody>
                    <tr>
                        <td>
                            <div class="explain-col">
                                <a class="add fb" href="<?php echo $this->_var['site_url']; ?>admin/usergroup/add/<?php echo $this->_var['current_id']; ?>"><input type="button" name="search" class="button" value="添加用户组" /></a>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
            <form name="myform" action="<?php echo $this->_var['action']; ?>" method="post">
                <div class="table-list">
                    <table width="100%" cellspacing="0">
                        <thead>
                            <tr>
                                <th width="38">排序</th>
                                <th width="45">ID</th>
                                <th>组名</th>
                                <th width="120" >经验数量</th>
                                <th>管理操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $_from = $this->_var['group_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'list');if (count($_from)):
    foreach ($_from AS $this->_var['list']):
?>
                            <tr>
                                <td align="center"><input type="text" class="input-text-c input-text" value="<?php echo $this->_var['list']['position']; ?>" size="3" name="position[<?php echo $this->_var['list']['id']; ?>]"></td>
                                <td align="center"><?php echo $this->_var['list']['id']; ?></td>
                                <td><font <?php if ($this->_var['list']['is_default'] == 1): ?>color="#0033FF"<?php endif; ?>><?php echo $this->_var['list']['name']; ?></font>(<?php echo $this->_var['list']['count_user']; ?>) &nbsp;&nbsp; <?php if ($this->_var['list']['is_default'] == 0): ?><a href="<?php echo $this->_var['site_url']; ?>admin/usergroup/set_default/<?php echo $this->_var['list']['id']; ?>" style="color:red;">设为默认</a> <?php endif; ?></td>
                                <td><?php echo $this->_var['list']['experience']; ?></td>
                                <td align="center"><a href="<?php echo $this->_var['site_url']; ?>admin/usergroup/edit/<?php echo $this->_var['list']['id']; ?>">修改</a> 
                                    | <a href="javascript:void(0);" class="delete" title="<?php echo $this->_var['list']['name']; ?>" id="<?php echo $this->_var['list']['id']; ?>">删除</a> 
                                    <?php if ($this->_var['list']['count_user'] != 0): ?>| <a href="javascript:void(0);" class="transfer"  title="<?php echo $this->_var['list']['id']; ?>">转移</a><?php endif; ?> </td>
                            </tr>  
                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                        </tbody>
                    </table>
                    <div class="btn">
                        <input type="submit" class="button" name="dosubmit"  value="排序"/>
                    </div>
                    <div id="pages"></div>
                </div>
            </form>
        </div>
        <script>
            $(function(){
                $('.delete').click(function(){
                    var title = $(this).attr('title');
                    var id = $(this).attr('id');
                    $.dialog.confirm('你确定要删除<font color=red>'+title+'</font>吗？', function(){
                        location.href="<?php echo $this->_var['site_url']; ?>admin/usergroup/delete/"+id;
                    }, function(){
                    });
                   
                });
                
                $('.transfer').click(function(){
                    var id = $(this).attr('title');
                    var name = $('#'+id).attr('title');
                    var html = "<select name='to_id' id='to_id'><?php echo $this->_var['select_group_list']; ?></select>";
                    $.dialog.confirm('你确定要转移<font color=red>'+name+'</font>下面的用户吗？', function(){
                        $.dialog({
                            content: "<form method='post' action='<?php echo $this->_var['transfer_action']; ?>"+id+"' target='right'>"+html+"<input type='submit' class='button'  value='提交'/></form>"
                        });
                    }, function(){
                    });
                   
                });
            });
        </script>
    </body>
</html>